package mo.leetcode_top;

import mo.common.ListNode;

public class L206 {

    public ListNode reverseList(ListNode head) {
        if (head == null) {
            return null;
        }
        ListNode res = new ListNode(head.val);
        ListNode tmp = head.next;
        while (tmp != null) {
            ListNode node = new ListNode(tmp.val);
            node.next = res;
            res = node;
            tmp = tmp.next;
        }
        return res;
    }

    public static void main(String[] args) {

    }

}
